function layer_open(title,url){
	var index = layer.open({
		type: 2,
		title: title,
		content: url
	});
	layer.full(index);
}
function policy_pulloff(id){
	layer.confirm('确认要挂起吗？',function(index){
		ajaxSubmit('POST', 'pulloff', 'policyId=' + id);
	});
}
function policy_puton(id){
	layer.confirm('确认要上架吗？',function(index){
		ajaxSubmit('POST', 'puton', 'policyId=' + id);
	});
}
function policy_edit(title,url){
	layer.close();
	var index = layer.open({
		type: 2,
		title: title,
		content: url
	});
	layer.full(index);
}
function policy_del(id){
	layer.confirm('确认要删除吗？',function(index){
		ajaxSubmit('POST', 'delete', 'policyId=' + id);
	});
}
/*批量-处理*/
function policy_upload(title,url,w,h){
	var ids = getCheckIds("policyIds");
	if (checkIds(ids)){
		layer_show(title,url + "?policyIds=" + ids,w,h);
	}
}
function policy_pulloffs(){
	var ids = getCheckIds("policyIds");
	if (checkIds(ids)){
		layer.confirm('确认要挂起吗？',function(index){
			ajaxSubmit('POST', 'pulloffs', "policyIds="+ids);
		});
	}
}
function policy_pulloffs_all(){
	$("input[name='choosePolicy']").prop("checked","true");
	$("input[name='policyIds']").prop("checked","true"); 
	var ids = getCheckIds("policyIds");
	if (checkIds(ids)){
		layer.confirm('确认要全部挂起吗？',function(index){
			ajaxSubmit('POST', 'pulloffs', "policyIds="+ids);
		});
	}
}
function policy_putons(){
	var ids = getCheckIds("policyIds");
	if (checkIds(ids)){
		layer.confirm('确认要上架吗？',function(index){
			ajaxSubmit('POST', 'putons', "policyIds="+ids);
		});
	}
}
function policy_putons_all(){
	$("input[name='choosePolicy']").prop("checked","true");
	$("input[name='policyIds']").prop("checked","true"); 
	var ids = getCheckIds("policyIds");
	if (checkIds(ids)){
		layer.confirm('确认要全部上架吗？',function(index){
			ajaxSubmit('POST', 'putons', "policyIds="+ids);
		});
	}
}
function policy_export(){
	var ids = getCheckIds("policyIds");
	if (checkIds(ids)){
		window.location= 'exportExcel?policyIds='+ids;
	}
}
function policy_dels(){
	var ids = getCheckIds("policyIds");
	if (checkIds(ids)){
		layer.confirm('确认要删除吗？',function(index){
			ajaxSubmit('POST', 'deleteAll', "policyIds="+ids);
		});
	}
}

function policy_copy(){
	var len = $("input[name='policyIds']:checked").length; 
	if(len != 1){
		layer.msg('请选择一条数据！！', {
			icon : 5,
			time : 1000
		});
		return false;
	}
	var ids = getCheckIds("policyIds");
	layer.confirm('确认要复制吗？',function(index){
		layer.msg("",{time:0.1});//为了关闭confirm窗口
		layer_open("编辑政策","copy?policyId="+ids);
	});
	
}
function choose_policy(){
	if($("input[name='policyIds']:checked").length == $("input[name='policyIds']").length){
		$("input[name='choosePolicy']").prop("checked","true");
	}else{
		$("input[name='choosePolicy']").removeProp("checked");
	}
}

function choose_policys(){
	if($("input[name='choosePolicy']").prop("checked")){
		$("input[name='policyIds']").prop("checked","true"); 
	}else{
		$("input[name='policyIds']").removeProp("checked"); 
	}
}
//function AirportCode(name, hidden) {
//	//alert(name+"    "+hidden);
//    jElass.exec({
//        input: name,
//        hidden: hidden,
//        url: '../airport/search',
//	    error : '很抱歉 暂时没有匹配的城市',width: 100
//    });
//}